package com.yanqu.road.entity.messageSubscribe.entity;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.enums.eMessageSubscribeType;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * @Description
 * @Author xx
 * @Data 2023年5月30日11:34:28
 */
public class MessageUserNoticeData extends DataObject {

    private long userId;

    private long lastUpdateTime;

    //徒弟培养满了提醒
    private long sonTime;
    //挚友谈心次数为满时
    private long mistressTime;
    //医馆病人数量达到存储上限时
    private long hospitalTime;
    //游历体力达到存储上限时
    private long travelTime;
    //商战所有门客出战次数均为满时
    private long patronsWarTime;
    //税所存储银两均为满时
    private long patronsWarSilverTime;
    //中午12:00狩猎开启时提醒
    private long noonHuntTime;
    //晚上8:00丘墟祭天开启时提醒
    private long nightHuntTime;
    //药铺病人数量达到存储上限时
    private long clinicTime;
    //招商位置被抢占时
    private long bussinessPosRobTime;
    //庄园粮仓收益达到收益上限时
    private long manorFoodTime;
    //地龙池地龙存储达到上限时
    private long manorDragonTime;
    //酒肆体力达到存储上限时
    private long wineShopTime;

    // 各种提醒时间
    private Map<eMessageSubscribeType, List<Long>> subTimeMap = new ConcurrentHashMap<>();

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }


    public long getSonTime() {
        return sonTime;
    }

    public void setSonTime(long sonTime) {
        if(sonTime != this.sonTime){
            this.sonTime = sonTime;
            setUpdateOption();
        }
    }

    public long getMistressTime() {
        return mistressTime;
    }

    public void setMistressTime(long mistressTime) {
        if(mistressTime != this.mistressTime){
            this.mistressTime = mistressTime;
            setUpdateOption();
        }
    }

    public long getHospitalTime() {
        return hospitalTime;
    }

    public void setHospitalTime(long hospitalTime) {
        if(hospitalTime != this.hospitalTime){
            this.hospitalTime = hospitalTime;
            setUpdateOption();
        }
    }

    public long getTravelTime() {
        return travelTime;
    }

    public void setTravelTime(long travelTime) {
        if(travelTime != this.travelTime){
            this.travelTime = travelTime;
            setUpdateOption();
        }
    }

    public long getPatronsWarTime() {
        return patronsWarTime;
    }

    public void setPatronsWarTime(long patronsWarTime) {
        if(patronsWarTime != this.patronsWarTime){
            this.patronsWarTime = patronsWarTime;
            setUpdateOption();
        }
    }

    public long getPatronsWarSilverTime() {
        return patronsWarSilverTime;
    }

    public void setPatronsWarSilverTime(long patronsWarSilverTime) {
        if(patronsWarSilverTime != this.patronsWarSilverTime){
            this.patronsWarSilverTime = patronsWarSilverTime;
            setUpdateOption();
        }
    }

    public long getNoonHuntTime() {
        return noonHuntTime;
    }

    public void setNoonHuntTime(long noonHuntTime) {
        if(noonHuntTime != this.noonHuntTime){
            this.noonHuntTime = noonHuntTime;
            setUpdateOption();
        }
    }

    public long getNightHuntTime() {
        return nightHuntTime;
    }

    public void setNightHuntTime(long nightHuntTime) {
        if(nightHuntTime != this.nightHuntTime){
            this.nightHuntTime = nightHuntTime;
            setUpdateOption();
        }
    }

    public long getClinicTime() {
        return clinicTime;
    }

    public void setClinicTime(long clinicTime) {
        if(clinicTime != this.clinicTime){
            this.clinicTime = clinicTime;
            setUpdateOption();
        }
    }

    public long getBussinessPosRobTime() {
        return bussinessPosRobTime;
    }

    public void setBussinessPosRobTime(long bussinessPosRobTime) {
        if(bussinessPosRobTime != this.bussinessPosRobTime){
            this.bussinessPosRobTime = bussinessPosRobTime;
            setUpdateOption();
        }
    }

    public long getManorFoodTime() {
        return manorFoodTime;
    }

    public void setManorFoodTime(long manorFoodTime) {
        if(manorFoodTime != this.manorFoodTime){
            this.manorFoodTime = manorFoodTime;
            setUpdateOption();
        }
    }

    public long getManorDragonTime() {
        return manorDragonTime;
    }

    public void setManorDragonTime(long manorDragonTime) {
        if(manorDragonTime != this.manorDragonTime){
            this.manorDragonTime = manorDragonTime;
            setUpdateOption();
        }
    }

    public long getWineShopTime() {
        return wineShopTime;
    }

    public void setWineShopTime(long wineShopTime) {
        if(wineShopTime != this.wineShopTime){
            this.wineShopTime = wineShopTime;
            setUpdateOption();
        }
    }

    public long getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(long lastUpdateTime) {
        if(lastUpdateTime != this.lastUpdateTime){
            this.lastUpdateTime = lastUpdateTime;
            setUpdateOption();
        }
    }

    public List<Long> getSubTime(eMessageSubscribeType eMSType) {
        return subTimeMap.getOrDefault(eMSType, null);
    }

    public void setSubTime(eMessageSubscribeType eMSType, List<Long> timeList) {
        if (timeList == null || timeList.isEmpty()) {
            return;
        }
        if (getSubTime(eMSType) == null) {
            this.subTimeMap.put(eMSType, timeList);
            setUpdateOption();
            return;
        }
        boolean had = new HashSet<>(timeList).containsAll(getSubTime(eMSType));
        boolean has = new HashSet<>(getSubTime(eMSType)).containsAll(timeList);
        if (!had || !has) {
            this.subTimeMap.put(eMSType, timeList);
            setUpdateOption();
        }
    }

    public Map<eMessageSubscribeType, List<Long>> getSubTimeMap() {
        return subTimeMap;
    }

    public void setSubTimeMap(Map<eMessageSubscribeType, List<Long>> subTimeMap) {
        this.subTimeMap = subTimeMap;
    }
}
